package com.study.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.study.bean.ImgBean;
import com.study.service.impl.AddCarItemService;
import com.study.tools.MyTools;

/**
 * Servlet implementation class deleteAction
 */
@WebServlet("/deleteAction")
public class deleteAction extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * 删除购物车中数据
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//把c_id放到实体类中
			    //String img01=request.getSession().getAttribute("c_id").toString();
				//String hing=request.getSession().getAttribute("host_id").toString();
				//Integer img2=new Integer(img01);
				//Integer img3=new Integer(hing);
		   ImgBean adminB=MyTools.formToBean(request, ImgBean.class);
            System.out.println("adminB:"+adminB);
			
				//利用c_id进行查询
				int img1=MyTools.getInstance(AddCarItemService.class).getdeleteInfo(adminB);	
				if(img1>0) {
					// 保存成功
				    
				  PrintWriter PW=response.getWriter();
				    PW.write(1);
				    PW.flush();
				    PW.close();
				}
	}

}
